1. The Field of the Invention
The present invention relates to electrical computers and data processing systems. Specifically, the present invention relates to methods and systems for copying and moving across virtual namespaces, and in particular copying and moving entire directory structures across virtual namespaces such as a Uniform Resource Identifier or URI.
2. The Prior State of the Art
One of the main utilities of computers is the ability to store files of information on a medium and then retrieve that file from the medium as needed. Such mediums might include, for example, an optical medium such as a CD-ROM, or a magnetic medium such as a tape inserted in a tape drive or a magnetic disk embedded within a magnetic disk drive. The mediums are typically divided into many individually addressed memory locations or sectors where a file or a portion of a file may be stored.
There are an endless variety of files that may be stored on such mediums including text files, image files, sound files, executable files, and so forth. Typically, a file system identifies the location of a file by mapping a xe2x80x9cphysical namespacexe2x80x9d to one or more physical sector addresses so that the file can be effectively retrieved on demand. Thus, a file can be said to reside at a physical namespace. In this application, the term xe2x80x9cphysical namespacexe2x80x9d is defined as a string of characters that directly represents a physical location on a computer.
In a conventional file system, a tree-like directory structure is used to organize files. A xe2x80x9cpathxe2x80x9d along that tree defines the physical namespace of the file. An example of a file path in the MS-DOS(copyright) operating system is xe2x80x9cC: maindir subdirectory file.extension wherein xe2x80x9cC: xe2x80x9d represents volume name, xe2x80x9cmaindirxe2x80x9d represents an optional main directory, xe2x80x9csubdirectoryxe2x80x9d represents an option subdirectory structure, xe2x80x9cfilexe2x80x9d represents the name of the file, and xe2x80x9cextensionxe2x80x9d represents an extension to the file indicative of the content type of the file. Similarly, a directory within the directory tree can also have a physical namespace similar to the file physical namespace except that no file or extension is specified. Hereinafter, the term xe2x80x9cresourcexe2x80x9d will be used to describe both files and directories.
It is often useful to copy a resource such as a file or directory from one physical namespace to another. A copy operation for a single file involves reading the file from a source physical namespace, and then writing the file to the destination physical namespace. A copy operation for an entire directory involves reading a file from the source physical namespace and then writing that file to the destination physical namespace one file at a time until all files from the source physical namespace are copied into the destination physical namespace. A move operation is essentially the same as a copy operation except that the resource at the source physical namespace is deleted at some point after it is read.
Recently, a technology called WEBDAV or xe2x80x9cWEB Distributed Authoring and Versioningxe2x80x9d has turned the Internet into a collaborative, writable medium such that resources can be copied and moved across uniform resource identifiers or URIs, not just across physical namespaces such as file system paths. According to proper WEBDAV usage, in the xe2x80x9cMOVExe2x80x9d and xe2x80x9cCOPYxe2x80x9d methods, a file is to be transferred from one URI to another URI. In addition, a directory or xe2x80x9ccollectionxe2x80x9d of resources is to be transferred from one URI directory to another URI directory. There are significant problems associated with transferring a collection of resources from one virtual namespace to another virtual namespace. These problems will be described in the following detailed description of the invention.
In light of the prior art, what are desired are methods and systems for copying and moving directories or xe2x80x9ccollectionsxe2x80x9d of virtual namespaces across virtual namespaces.
The present invention relates to a method and system for copying or moving a collection of resources from a source virtual namespace to a destination virtual namespace. These virtual namespaces may be, for example, Uniform Resource Identifiers or URIs that are commonly used to identify Internet and Intranet resources. In this case, the collection of resources would be a directory within the URI. For example, the method could copy or move the files within the URI directory xe2x80x9chttp://server/dir1/xe2x80x9d to a new URI directory xe2x80x9chttp://server/newdir1xe2x80x9d.
These virtual namespaces correspond to physical namespaces where the files are physically stored. An example of a physical namespace might be a file system path. Sometimes, the source or virtual namespace directory structure will correspond to non-contiguous physical namespaces. For example, the virtual namespace xe2x80x9chttp://server/dir1/xe2x80x9d may correspond to a physical namespace of xe2x80x9cC: main directory1 xe2x80x9d, while one of the subdirectories of the virtual namespace such as xe2x80x9chttp://server/dir1/subdir1/xe2x80x9d corresponds to an entirely different physical namespace xe2x80x9cG: sample xe2x80x9d. Thus, the directory hierarchy of the virtual namespaces does not necessarily follow the directory hierarchy of the physical namespaces.
The computer system receives a request to copy or move a collection of resources from the source virtual directory corresponding to one or more physical namespaces to a destination virtual directory corresponding to one or more physical namespaces. In response to this request, the computer system performs the requested copy or move operation.
In order to copy or move the collection, the method performs the following acts for the parent directory and then for those subdirectories at any level underneath the parent directory. If security permission is not granted for a certain subdirectory, copying and moving will not occur for that subdirectory. For each directory, the computer system determines the physical namespace that corresponds to the virtual namespace of that directory. This may involve looking up the physical namespace in a table if the virtual namespace of that directory is directly mapped to a physical namespace. Otherwise, the physical namespace may be determined by removing one directory at a time from the right hand side of the virtual namespace until a virtual namespace is found for which there is a direct mapping in the table to a physical namespace. Then the subdirectories removed are added back to the right hand side of the physical namespace to obtain the physical namespace for that directory. This process is performed for both the directory in the source virtual namespace and the corresponding directory in the destination virtual namespace. Next, the files are copied from the directory of the source physical namespace to the directory of the destination physical directory. In a move operation, the files within that source directory are deleted after copying.
In the entire method, only the virtual namespaces are exposed to the entity making the copy or move request. In implementation, the computer system may need to translate this copy or move requests into several physical namespace copy or move requests since the physical namespaces corresponding to a virtual namespace may not be contiguous. The method allows a user to treat the Internet as a readable and writable medium organized in a tree-like directory structure. File systems enable users to move files from one physical namespace to another physical namespace using a single command. The method of the present invention permits the same over the Internet using URIs.
Additional advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the invention. The advantages of the invention may be realized and obtained by means of the instruments and combinations particularly pointed out in the appended claims. These and other features of the present invention will become more fully apparent from the following description and appended claims, or may be learned by the practice of the invention as set forth hereinafter.